function debounce(func) {
  let timer = null
  return (e) => {
    if (timer) clearTimeout(timer)
    timer = setTimeout(() => {
      func && func(e)
    }, 2000)
  }
}

export { debounce }
